#ifndef __DAEMON_SUB_PROCESS_H__
#define __DAEMON_SUB_PROCESS_H__
#include"unistd.h"
#include<sys/types.h>
#define MAX_SUB_FAIL_COUNT 3
typedef struct 
{
    char* cmd;//子进程的命令 app ota 
    pid_t pid;//子进程的pid
    int fail_count;//失败次数
}sub_process_t;


/**
 * 初始化子进程
 */

 sub_process_t* daemon_sub_process_init(char* cmd);
/**
 * 检测或启动子进程
 */
int daemon_sub_process_check_and_start( sub_process_t* sub_process);

/**
 * 销毁子进程
 */
    void daemon_sub_process_destroy( sub_process_t* sub_process);
#endif /* __DAEMON_SUB_PROCESS_H__ */